home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 1995 March / PC Plus Super CD (Issue 101) (March 1995).iso / sharewar / vbaddon / vbfiles / sam4fnam.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-06-17  |  7.2 KB  |  214 lines

  1. VERSION 2.00
  2. Begin Form frmRenameFields 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "VB/ISAM Sample Program SAM4 -- Rename Fields"
  6.    ClientHeight    =   1425
  7.    ClientLeft      =   1410
  8.    ClientTop       =   3495
  9.    ClientWidth     =   6675
  10.    ControlBox      =   0   'False
  11.    Height          =   2115
  12.    Left            =   1350
  13.    LinkTopic       =   "Form1"
  14.    MaxButton       =   0   'False
  15.    MinButton       =   0   'False
  16.    ScaleHeight     =   1425
  17.    ScaleWidth      =   6675
  18.    Top             =   2865
  19.    Width           =   6795
  20.    Begin SSPanel plnWholeForm 
  21.       Align           =   1  'Align Top
  22.       BackColor       =   &H00C0C0C0&
  23.       BevelInner      =   1  'Inset
  24.       Font3D          =   0  'None
  25.       ForeColor       =   &H00FF0000&
  26.       Height          =   1395
  27.       Left            =   0
  28.       TabIndex        =   3
  29.       Top             =   0
  30.       Width           =   6675
  31.       Begin SSPanel pnlSpinner 
  32.          BackColor       =   &H00C0C0C0&
  33.          BevelInner      =   1  'Inset
  34.          Font3D          =   0  'None
  35.          ForeColor       =   &H00FF0000&
  36.          Height          =   615
  37.          Left            =   1650
  38.          TabIndex        =   2
  39.          Top             =   330
  40.          Width           =   495
  41.          Begin SpinButton spnSpinButton 
  42.             BackColor       =   &H00C0C0C0&
  43.             Delay           =   75
  44.             ForeColor       =   &H00000000&
  45.             Height          =   435
  46.             Left            =   90
  47.             ShadowBackColor =   &H00808080&
  48.             ShadowForeColor =   &H00FFFFFF&
  49.             SpinForeColor   =   &H000000FF&
  50.             TdThickness     =   2
  51.             Top             =   90
  52.             Width           =   315
  53.          End
  54.       End
  55.       Begin SSPanel pnlDoneButton 
  56.          BackColor       =   &H00C0C0C0&
  57.          BevelInner      =   1  'Inset
  58.          Font3D          =   0  'None
  59.          ForeColor       =   &H00FF0000&
  60.          Height          =   975
  61.          Left            =   5070
  62.          TabIndex        =   5
  63.          Top             =   210
  64.          Width           =   1365
  65.          Begin SSCommand cmdDone 
  66.             Caption         =   "Done"
  67.             Font3D          =   0  'None
  68.             FontBold        =   0   'False
  69.             FontItalic      =   0   'False
  70.             FontName        =   "MS Sans Serif"
  71.             FontSize        =   8.25
  72.             FontStrikethru  =   0   'False
  73.             FontUnderline   =   0   'False
  74.             Height          =   795
  75.             Left            =   90
  76.             Outline         =   0   'False
  77.             Picture         =   SAM4FNAM.FRX:0000
  78.             TabIndex        =   1
  79.             Top             =   90
  80.             Width           =   1185
  81.          End
  82.       End
  83.       Begin TextBox txtFieldName 
  84.          Height          =   315
  85.          Left            =   2340
  86.          TabIndex        =   0
  87.          Text            =   "Text1"
  88.          Top             =   480
  89.          Width           =   2535
  90.       End
  91.       Begin Label Label3 
  92.          BackStyle       =   0  'Transparent
  93.          Caption         =   "Field Name"
  94.          FontBold        =   0   'False
  95.          FontItalic      =   0   'False
  96.          FontName        =   "MS Sans Serif"
  97.          FontSize        =   8.25
  98.          FontStrikethru  =   0   'False
  99.          FontUnderline   =   0   'False
  100.          Height          =   225
  101.          Left            =   2340
  102.          TabIndex        =   8
  103.          Top             =   210
  104.          Width           =   1245
  105.       End
  106.       Begin Label Label2 
  107.          BackStyle       =   0  'Transparent
  108.          Caption         =   "Up/Dn"
  109.          FontBold        =   0   'False
  110.          FontItalic      =   0   'False
  111.          FontName        =   "MS Sans Serif"
  112.          FontSize        =   8.25
  113.          FontStrikethru  =   0   'False
  114.          FontUnderline   =   0   'False
  115.          Height          =   225
  116.          Left            =   1650
  117.          TabIndex        =   7
  118.          Top             =   990
  119.          Width           =   585
  120.       End
  121.       Begin Label Label1 
  122.          BackStyle       =   0  'Transparent
  123.          Caption         =   "Field No. / Type"
  124.          FontBold        =   0   'False
  125.          FontItalic      =   0   'False
  126.          FontName        =   "MS Sans Serif"
  127.          FontSize        =   8.25
  128.          FontStrikethru  =   0   'False
  129.          FontUnderline   =   0   'False
  130.          Height          =   225
  131.          Left            =   270
  132.          TabIndex        =   6
  133.          Top             =   210
  134.          Width           =   1245
  135.       End
  136.       Begin Label lblFieldNum 
  137.          BackColor       =   &H00FFFFFF&
  138.          BorderStyle     =   1  'Fixed Single
  139.          Caption         =   "123 [X$*123]"
  140.          Height          =   255
  141.          Left            =   240
  142.          TabIndex        =   4
  143.          Top             =   510
  144.          Width           =   1245
  145.       End
  146.    End
  147.    Begin Menu mnuMouseless 
  148.       Caption         =   "Mouseless operation"
  149.       Begin Menu mnuSpinHigher 
  150.          Caption         =   "Spin to &higher field"
  151.       End
  152.       Begin Menu mnuSpinLower 
  153.          Caption         =   "Spin to &lower field"
  154.       End
  155.    End
  156. Option Explicit
  157. Dim ValueChangedFlag As Integer
  158. Sub cmdDone_Click ()
  159.     If ValueChangedFlag = True Then UpdateSchema
  160.     Me.Hide
  161. End Sub
  162. Sub DisplayNewField ()
  163.         SchemaLine = DS_GetField(Schema, CRLFDelim, FieldNum + 1)
  164.         ThisType = DS_GetField(SchemaLine, BarDelim, 2)
  165.         If ThisType = "&" Then  'Windows gets weird with ampersands!
  166.             lblFieldNum.Caption = Format$(FieldNum, "000") & " [" & "&&" & "]"
  167.         Else
  168.             lblFieldNum.Caption = Format$(FieldNum, "000") & " [" & ThisType & "]"
  169.         End If
  170.         txtFieldName.Text = DS_GetField(SchemaLine, BarDelim, 3)
  171.         lblFieldNum.Refresh
  172.         txtFieldName.Refresh
  173. End Sub
  174. Sub Form_Activate ()
  175.     ValueChangedFlag = False    'init.
  176. End Sub
  177. Sub mnuSpinHigher_Click ()
  178.     spnSpinButton_SpinDown
  179. End Sub
  180. Sub mnuSpinLower_Click ()
  181.     spnSpinButton_SpinUp
  182. End Sub
  183. Sub spnSpinButton_SpinDown ()
  184.     If ValueChangedFlag = True Then UpdateSchema
  185.     If FieldNum < NumberOfFields Then
  186.         FieldNum = FieldNum + 1
  187.         DisplayNewField
  188.     End If
  189. End Sub
  190. Sub spnSpinButton_SpinUp ()
  191.     If ValueChangedFlag = True Then UpdateSchema
  192.     If FieldNum > 0 Then
  193.         FieldNum = FieldNum - 1
  194.         DisplayNewField
  195.     End If
  196. End Sub
  197. Sub txtFieldName_Change ()
  198.     ValueChangedFlag = True
  199. End Sub
  200. Sub txtFieldName_LostFocus ()
  201.     UpdateSchema
  202. End Sub
  203. Sub UpdateSchema ()
  204.     'Reset local flag
  205.     ValueChangedFlag = False
  206.     If txtFieldName.Text <> "" Then
  207.         'Use new value of txtFieldName.Caption to update schema:
  208.         SchemaLine = DS_PutField(SchemaLine, BarDelim, 3, US_Trim((txtFieldName.Text)))
  209.         Schema = DS_PutField(Schema, CRLFDelim, FieldNum + 1, SchemaLine)
  210.         'Set flag to require update of display and rewrite of schema file:
  211.         SchemaDirtyFlag = True
  212.     End If
  213. End Sub
  214.